'Paste the first 4 functions at the top of your module. Provide server name, port, username, password, local file name and the file you want it named to the procedure UploadFile

'Paste at the top of your code file
Private Declare Function InternetOpen Lib "wininet.dll" Alias "InternetOpenA" _
(ByVal sAgent As String, ByVal lAccessType As Long, ByVal sProxyName As String, _
ByVal sProxyBypass As String, ByVal lFlags As Long) As Long

Private Declare Function InternetConnect Lib "wininet.dll" Alias "InternetConnectA" _
(ByVal hInternetSession As Long, ByVal sServerName As String, ByVal nServerPort As Integer, _
ByVal sUserName As String, ByVal sPassword As String, ByVal lService As Long, ByVal lFlags As Long, _
ByVal lContext As Long) As Long

Private Declare Function FtpPutFile Lib "wininet.dll" Alias "FtpPutFileA" _
(ByVal hConnect As Long, ByVal lpszLocalFile As String, ByVal lpszNewRemoteFile As String, _
ByVal dwFlags As Long, ByVal dwContext As Long) As Boolean

Private Const INTERNET_SERVICE_FTP = 1


'Upload method
Public Sub UploadFile(ByRef server As String, ByRef username As String, ByRef password As String, _
ByRef port As Integer, ByRef localFileName As String, ByRef remoteFileName As String)
    Dim session As Long
    Dim connection As Long
    
    On Error GoTo UploadError
    
    Set session = InternetOpen("MyApplication", 0, vbNullString, vbNullString, 0)
    Set connection = InternetConnect(session, server, port, username, password, INTERNET_SERVICE_FTP, 0, 0)
    
    If FtpPutFile(connection, localFileName, remoteFileName, False, 1, 0) = False Then
        MsgBox "File: " & localFileName & " uploaded successfully!"
    Else
        MsgBox "ERROR: " & Err.Description
    End If
UploadError:
    MsgBox Err.Description
 End Sub